<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" session="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
    <title>红包领取记录</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="renderer" content="webkit">
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="0">
    
    <link href="${pageContext.request.contextPath}/static/css/common.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/css/bootstrap.min.css"
          rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/font-awesome-4.3.0/css/font-awesome.min.css"
          rel="stylesheet">
    <!-- jqgrid-->
    <link href="${pageContext.request.contextPath}/static/plugins/jqGrid/css/custom.ui.jqgrid.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/layer/skin/layer.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/jqGrid/css/style.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/plugins/select2-4.0.0/dist/css/select2.min.css"
          rel="stylesheet">    

    <script src="${pageContext.request.contextPath}/static/js/jquery-1.11.3.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/jquery.form.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/common.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/bootstrap-3.3.5/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/jqGrid/js/i18n/grid.locale-cn.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/jqGrid/js/minified/jquery.jqGrid.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/plugins/layer/layer.js" type="text/javascript"></script>
    <script src="${pageContext.request.contextPath}/static/js/global.js"></script>
	<script src="${pageContext.request.contextPath}/static/plugins/select2-4.0.0/dist/js/select2.min.js"></script>
	<script type="text/javascript"
            src="${pageContext.request.contextPath}/static/plugins/My97DatePicker/WdatePicker.js"></script>
</head>
<style>
	.ui-jqgrid{
		padding-left: 9px;
		padding-right:9px;
	}
	.ui-jqgrid .ui-jqgrid-pager .ui-paging-info{
		margin-right:15px;
	}
</style>
<body >
    <div class="jqGrid_wrapper" style="height: 100%;">
        <table id="jqGrid"></table>
        <div id="jqGrid_paper"></div>
    </div>
</body>
  
<script type="text/javascript">
$(document).ready(
        function () {
            $.jgrid.defaults.styleUI = "Bootstrap";
            $("#jqGrid").jqGrid(
                    {
                        url: "${pageContext.request.contextPath}/admin/redPacket_receiveLogList.action?sid=${sid}",
                        mtype: 'POST',
						height:350,
                        datatype: "json",
                        autowidth: true,
                        shrinkToFit: true,
                        rowNum: 10,
                        rowList: [10, 20, 30],
                        colNames: ['序号', '合作方名称', '小区名称', '门禁PID', '门禁名称', '用户手机号', '红包名称', '红包金额(元)',
                            '开门时间'],
                        colModel: [{
                            name: "SID",
                            index: "SID",
                            key: true,
                            hidden: true
                        }, {
                            name: 'AGTNAME',
                            index: 'AGTNAME',
                            width: 60
                        },{
                            name: "COMNAME",
                            index: "COMNAME",
                            width: 60
                        }, {
                            name: 'PID',
                            index: 'PID',
                            width: 60
                        },{
                            name: 'LOCKNAME',
                            index: 'LOCKNAME',
                            width: 60
                        },{
                            name: 'TEL',
                            index: 'TEL',
                            width: 50
                        },{
                            name: 'RNAME',
                            index: 'RNAME',
                            width: 60
                        }, {
                            name: "REMONEY",
                            index: "REMONEY",
                            width: 50
                        }, {
                            name: "RETIME",
                            index: "RETIME",
                            width: 80
                       }],
                        sortname: 'sid',
                        rownumbers: true,
                        jsonReader: {
                            root: 'rows',
                            page: "page",
                            total: 'total',
                            records: "records",
                            repeatitems: false
                        },
                        pager: "#jqGrid_paper",
                        viewrecords: true,
                        hidegrid: false,
                        loadComplete: function(){
                    		var re_records = Number($("#jqGrid").getGridParam('records'));
                    		var page = Number($("#jqGrid").getGridParam('page'));
                    		var rows=Number($("#jqGrid").getGridParam('rowNum'));
                    		var num = re_records-(page-1)*rows;
                    		if(num < rows)
                    		{
                    			for(var i=num;i<rows;i++){
                    				$("#jqGrid").jqGrid("addRowData",(i+1),
                            				{ "SID":"", "RNAME":"", "AUDITSTATUS":"no", "COMUNAME":"no", "DATESTART":"no","CNUM":"no","AMOUNT":"no","CZ":"no"}
                    				,"");
                    			}
                    			$(".ui-paging-info").html(re_records-num+1 +" - "+re_records+"　共 "+re_records+" 条");
                    		}

                    	}
                    });
        });	
</script>
</html>
